home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / Include / lfsSuperBlock.h < prev    next >
C/C++ Source or Header  |  1990-10-19  |  4KB  |  114 lines

  1. /*
  2.  * lfsSuperBlock.h --
  3.  *
  4.  *    Declarations defining the disk resident format of the LFS 
  5.  *    super block. The main purpose of the super block is to allow
  6.  *    the file system to be recovered and reattached upon file server
  7.  *    reboot. The super block is divided into two section the static
  8.  *    super block and the checkpoint area.  The super block
  9.  *    contains the nonchangable parameters that describe the LFS. 
  10.  *    The checkpoint area contains the parameters that change when the
  11.  *    file system is modified.
  12.  *
  13.  * Copyright 1989 Regents of the University of California
  14.  * Permission to use, copy, modify, and distribute this
  15.  * software and its documentation for any purpose and without
  16.  * fee is hereby granted, provided that the above copyright
  17.  * notice appear in all copies.  The University of California
  18.  * makes no representations about the suitability of this
  19.  * software for any purpose.  It is provided "as is" without
  20.  * express or implied warranty.
  21.  *
  22.  * $Header: /sprite/src/kernel/lfs/RCS/lfsSuperBlock.h,v 1.4 90/10/19 17:23:11 mendel Exp $ SPRITE (Berkeley)
  23.  */
  24.  
  25. #ifndef _LFSSUPERBLOCK
  26. #define _LFSSUPERBLOCK
  27.  
  28. #ifdef EKERNEL
  29. #include <lfsDescMap.h>
  30. #include <lfsUsageArray.h>
  31. #include <lfsFileLayout.h>
  32. #else
  33. #include <kernel/lfsDescMap.h>
  34. #include <kernel/lfsUsageArray.h>
  35. #include <kernel/lfsFileLayout.h>
  36. #endif
  37. /*
  38.  * The LfsSuperBlockHdr contains static parameters describing the file system
  39.  * layout on disk. 
  40.  */
  41. #define    LFS_SUPER_BLOCK_HDR_SIZE    128
  42. typedef struct LfsSuperBlockHdr {
  43.     unsigned int magic;        /* Better be LFS_SUPER_BLOCK_MAGIC. */
  44.     unsigned int version;      /* Version number describing the format used
  45.                  * for this LFS.  */
  46.     int blockSize;        /* The block size of this file system. Should
  47.                  * be set to the minumum addressable unit. */
  48.     /*
  49.      * File system layout. 
  50.      */
  51.     int maxCheckPointBlocks;  /* Maximum size of checkpoint region in blocks. */
  52.     int checkPointOffset[2];/* The block offset into the device of the
  53.                  * two checkpoint areas. Two areas are
  54.                  * used so we never update in place. The
  55.                  * format the segment is defined below. */
  56.     int logStartOffset;     /* The block offset starting the segmented log. */
  57.     int     checkpointInterval;    /* Frequency of checkpoint in seconds. */
  58.     int  maxNumCacheBlocks;     /* Maximum number of blocks to clean at time.*/
  59.     char reserved[LFS_SUPER_BLOCK_HDR_SIZE-8*sizeof(int)];
  60.                 /* Reserved, must be set to zero. */
  61.  
  62. } LfsSuperBlockHdr;
  63.  
  64. #define    LFS_SUPER_BLOCK_MAGIC        0x106d15c     /* LogDisc */
  65. #define    LFS_SUPER_BLOCK_VERSION        1
  66. #define    LFS_SUPER_BLOCK_SIZE        512
  67. #define LFS_SUPER_BLOCK_OFFSET        64
  68. /*
  69.  * The format a LFS super block. 
  70.  */
  71. typedef struct LfsSuperBlock {
  72.     LfsSuperBlockHdr  hdr;    /* Header describing the layout of the LFS. */
  73.     LfsDescMapParams  descMap;    /* Descriptor map parameters. */
  74.     LfsSegUsageParams usageArray; /* The segment usage map parameters. */
  75.     LfsFileLayoutParams fileLayout; /* Parameters describing file layout. */
  76.     char padding[LFS_SUPER_BLOCK_SIZE-sizeof(LfsFileLayoutParams) - 
  77.          sizeof(LfsSegUsageParams)-sizeof(LfsDescMapParams) -
  78.          sizeof(LfsSuperBlockHdr)];    
  79. } LfsSuperBlock;
  80.  
  81.  
  82. /*
  83.  * Format of the LFS checkpoint areas.  The checkpoint area consists of
  84.  * a LfsCheckPointHdr structure followed by zero or more LfsCheckPointRegion
  85.  * from each module.  The last LfsCheckPointRegion is ended with a 
  86.  * LfsCheckPointTrailer.
  87.  */
  88.  
  89. typedef struct LfsCheckPointHdr {
  90.     unsigned int timestamp;    /* Timestamp of this checkpoint. */
  91.     int size;            /* Size of checkpoint in bytes. */
  92.     unsigned int version;    /* Region write version number. */
  93.     char domainPrefix[64];    /* Last prefix used for the domain */
  94.     int     domainNumber;        /* Last domain we ran under. */
  95.     int     attachSeconds;        /* Time the disk was attached */
  96.     int     detachSeconds;        /* Time the disk was off-lined. */
  97.     int     serverID;        /* Sprite ID of server. */
  98. } LfsCheckPointHdr;
  99.  
  100. typedef struct LfsCheckPointRegion {
  101.     unsigned int type;        /* Region type -- see log writing types in
  102.                  * lfsLogFormat.h. */
  103.     int size;            /* Size of the region in bytes. */
  104. } LfsCheckPointRegion;
  105.  
  106. typedef struct LfsCheckPointTrailer {
  107.     unsigned int timestamp;    /* Timestamp of this checkpoint. Must match
  108.                  * the checkpoint on header. */
  109.     unsigned int checkSum;    /* A checksum of the checkpoint check used to
  110.                  * detect partial checkpoint writes. */
  111. } LfsCheckPointTrailer;
  112.  
  113. #endif /* _LFSSUPERBLOCK */
  114.